package lesson16;

public  class Person {
	
	private static int personId = 1;   
	static String coureseName = "JavaEE";
	
	public String name;
	String adress;
	private final String egn;
	private String password;
	private int age;
	
	
	
	
	public Person(String egn,String password){
		   
		this.egn = egn;
		this.password = password;
	}
	public void changePassword(String oldPassword,String newPassword){
		if(this.password.equals(oldPassword)){
			this.password = newPassword;
		}
	}
	
	public void setAge(int age){
		if(age>=0||age<200){
			this.age = age;
		}
	}
	
	public int getAge(String password){
		if(this.password.equals(password)){
			return this.age;
		}else
			return -1;
	}

	
}
